cmake_minimum_required(VERSION 3.22)
project(example)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/output) # 设置可执行目标文件的输出目录
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/output) # 设置静态库文件的输出目录

add_subdirectory(src)
add_subdirectory(lib)

target_link_libraries(main mylib)

if (DEBUG)
    target_compile_definitions(mylib PRIVATE DEBUG_INFO)
endif()


set(CMAKE_INSTALL_PREFIX /home/shengyi/install/my_test)
install(TARGETS main DESTINATION bin)
install(TARGETS mylib DESTINATION lib)
install(FILES lib/mylib.h DESTINATION include)

enable_testing()